import { ElLoading } from 'element-plus'

let loading: {
  close: () => void
}

const openLoading = () => {
  loading = ElLoading.service({
    body: true,
    lock: true,
    text: '正在加载...',
    spinner: 'el-icon-loading',
    background: 'rgba(255,255,255,0.3)'
  })
}

const closeLoading = () => {
  loading.close()
}

export {
  openLoading, closeLoading
}

